package com.rizzo.android.domain;

import com.j256.ormlite.field.DatabaseField;
import com.j256.ormlite.table.DatabaseTable;

import java.io.Serializable;
import java.util.Date;

@DatabaseTable(tableName = Quota.TABLE_NAME)
public class Quota implements Serializable {

	public static final String TABLE_NAME = "quota";
	public static final String ID_FIELD = "_id";
	public static final String METHOD_FIELD = "method";
	public static final String APPLICATION_FIELD = "application";
	public static final String USER_FIELD = "user";
	public static final String HITS_FIELD = "hits";
	public static final String LAST_UPDATED_FIELD = "last_updated";
	public static final String METHOD_INDEX = "method_idx";
	public static final String APPLICATION_INDEX = "application_idx";
	public static final String[] AVAILABLE_FIELDS = {ID_FIELD, METHOD_FIELD, APPLICATION_FIELD, USER_FIELD, HITS_FIELD};

	@DatabaseField(id = true, generatedId = true, columnName = ID_FIELD)
	private long id;

	@DatabaseField(canBeNull = false, columnName = METHOD_FIELD, index = true, indexName = METHOD_INDEX)
	private String method;

	@DatabaseField(canBeNull = false, columnName = APPLICATION_FIELD, index = true, indexName = APPLICATION_INDEX)
	private String application;

	@DatabaseField(canBeNull = false, columnName = USER_FIELD)
	private String user;

	@DatabaseField(canBeNull = false, columnName = HITS_FIELD)
	private long hits;

	@DatabaseField(canBeNull = false, columnName = LAST_UPDATED_FIELD)
	private Date lastUpdated;

	public Quota() {
	}

	public Quota(String method, String application, String user, long hits) {
		this.application = application;
		this.hits = hits;
		this.method = method;
		this.user = user;
	}

	public long getId() {
		return id;
	}

	public void setId(long id) {
		this.id = id;
	}

	public String getApplication() {
		return application;
	}

	public void setApplication(String application) {
		this.application = application;
	}

	public long getHits() {
		return hits;
	}

	public void setHits(long hits) {
		this.hits = hits;
	}

	public String getMethod() {
		return method;
	}

	public void setMethod(String method) {
		this.method = method;
	}

	public String getUser() {
		return user;
	}

	public void setUser(String user) {
		this.user = user;
	}

	public Date getLastUpdated() {
		return lastUpdated;
	}

	public void setLastUpdated(Date lastUpdated) {
		this.lastUpdated = lastUpdated;
	}
}
